<template>
  <div class="position clearfix">
    <router-link to="/admin">
      <Icon type="md-home" size="14"/>首页
    </router-link>
    
    <template v-for="(p,i) in position">
       <Icon type="ios-arrow-forward" />
       <router-link :to="p.link"  v-if="p.link">{{p.title}}</router-link>
       <span  v-else>{{p.title}}</span>
    </template>

    <div class="fr" v-show="showBack">
      <Button @click="$router.go(-1)" size="small">返回</Button>
    </div>
  </div>
</template>

<script>
  export default{
    computed: {
      position () {
        return this.$store.state.position
      },
      showBack () {
        return this.$store.state.showBack || this.position.length > 2
      }
    }
  }
</script>

<style scoped>
.position{
  font-size: 12px;
  background: #F2F2F2;
  padding: 0 10px;
  line-height: 40px;
  .ivu-icon{
    vertical-align: middle;
  }
  a{
    color: #137EE8;
  }
}
</style>
